package com.shensi.appCollect.dao;


import com.shensi.appCollect.pojo.CustomerCardSetting;
import com.shensi.appCollect.pojo.CustomerCardSettingDetail;
import com.shensi.appCollect.pojo.CustomerCardUseRecord;
import com.shensi.appCollect.pojo.CustomerElectronicCard;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;


public interface ElectronicMembershipCardMapper {


    //获取用户储蓄卡列表
    List<CustomerElectronicCard> getElectronicCardListBycardOilsTypeArray(CustomerElectronicCard customerElectronicCard);

    //获取用户储蓄卡列表
    List<CustomerElectronicCard> getElectronicCardList(CustomerElectronicCard customerElectronicCard);

    //获取活用要充值电子会员卡的信息
    CustomerElectronicCard getElectronicCardInfo(CustomerElectronicCard customerElectronicCard);

    //更新电子会员卡信息
    void updateElectronicCardInfoByPhone(CustomerElectronicCard customerElectronicCard);

    //获取用户储蓄卡的使用记录
    List<CustomerCardUseRecord> getCardUseRecordList(CustomerCardUseRecord customerCardUseRecord);

    //新增电子会员卡充值使用记录
    void insetCardUseRecordRecharge(CustomerCardUseRecord customerCardUseRecord);
    //修改电子会员卡充值使用记录
    void updateCardUseRecordRecharge(CustomerCardUseRecord customerCardUseRecord);

    //新增电子会员卡消费使用记录
    void insetCardUseRecordConsumption(CustomerCardUseRecord customerCardUseRecord);

    //根据订单号查询电子会员卡的充值记录信息
    CustomerCardUseRecord getCardRecordByOrderNo(CustomerCardUseRecord customerCardUseRecord);
    //根据商户订单号查询电子会员卡的充值记录信息
    CustomerCardUseRecord getCardRecordByMerchantsNumber(CustomerCardUseRecord customerCardUseRecord);
    //根据unionId更新客户余额
    void updateElectronicCardInfo(CustomerElectronicCard customerElectronicCard);

    //根据订单号更新用户充值记录的状态
    void updateCardRecordStatusByOrderNo(CustomerCardUseRecord customerCardUseRecord);

    //查询油站电子会员卡（储蓄卡）充值设置规则
    List<CustomerCardSetting> getCardRechargeSettingList(CustomerCardSetting customerCardSetting);

    //查询油站的会员卡启用标识 （1、启动 2，停用)
    String getStationCardEnabledFlag(Integer stationId);

    //根据unionId获取用户用要充值电子会员卡(储蓄卡)信息
    CustomerElectronicCard getElectronicCardInfoByPhone(CustomerElectronicCard customerElectronicCard);

    /**
     * 获取返利金电子卡  获取返利金最多 id 最大的那张电子卡
     * @param customerElectronicCard
     * @return
     */
    CustomerElectronicCard getElectronicCardInfoByReturnCash(CustomerElectronicCard customerElectronicCard);

    //插入电子会员卡
    void insetElectronicCard(CustomerElectronicCard customerElectronicCard);

    //根据小程序用户openId查询客户电子会员卡信息-
    CustomerElectronicCard getElectronicCardInfoByMinaOpenId(CustomerElectronicCard customerElectronicCard);

    //查询电子卡的最低充值金额
    List<CustomerCardSetting> getCardRechargeMinAmt(CustomerCardSetting customerCardSetting);

    BigDecimal countCardBalance(@Param("mobilePhone") String mobilePhone,
                                //@Param("memberCode") String memberCode,
                                @Param("enterpriseId") Integer enterpriseId,
                                @Param("cardUseForAll") boolean cardUseForAll,
                                @Param("cardTypes") List<String> types);

    List<CustomerCardSettingDetail> selectCardSettingDetail(CustomerCardSettingDetail customerCardSettingDetail);

    BigDecimal getFreezePresentAmt(CustomerCardUseRecord useRecordQuery);

    List<CustomerCardSettingDetail> getDetailAndContent(CustomerCardSettingDetail customerCardSettingDetail);

    CustomerCardUseRecord selectCustomerCardUseRecordByOrderNo(String orderNo);

    int incrCustomerElectronicCardBalance(@Param("incrAmt") BigDecimal incrAmt,@Param("incrPresentAmt") BigDecimal incrPresentAmt, @Param("card") CustomerElectronicCard card);

    //更新用户的电子会员卡的金额和赠送金额
    int updateUserPresentAmt(Map<String, Object> map);

    //查询客户电子卡交易记录列表
    List<CustomerCardUseRecord> selectCustomerCardUseRecords(CustomerCardUseRecord customerCardUseRecord);

    /**
     * 修改返利金余额
     * @param customerElectronicCard
     * @return
     */
    int updateReturnCashById(CustomerElectronicCard customerElectronicCard);
}
